package com.java.demo.model;

import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

/**
 * 公共类
 */
@Component
public class Users {
    /**
     * 公共对象
     */
    @Bean("user")
    //@Scope("prototype") //原型模式 | 多列模式
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public User getUser() {
        User user = new User();
        user.setId(666);
        user.setName("李四");
        return user;
    }
}
